package com.example.demo.Util;

import com.example.demo.Entity.AdminApplication;
import com.example.demo.Entity.IllegalAction;
import com.example.demo.Entity.UnlockApplication;

import java.util.Date;

public class UserApplicationAndActionUtil {

    public static IllegalAction createLockAction(String uid) {
        IllegalAction illegalAction = new IllegalAction();
        illegalAction.setUserID(uid);
        illegalAction.setOrderID(0);
        illegalAction.setActionDate(new Date());
        illegalAction.setDetail("用户被封禁");
        return illegalAction;
    }

    public static IllegalAction createOrderWithoutPayAction(String uid, long oid) {
        IllegalAction illegalAction = new IllegalAction();
        illegalAction.setUserID(uid);
        illegalAction.setOrderID(oid);
        illegalAction.setActionDate(new Date());
        illegalAction.setDetail("用户下订单未付款");
        return illegalAction;
    }

    public static UnlockApplication createUnlockApplication(String uid, String reason) {
        UnlockApplication unlockApplication = new UnlockApplication();
        unlockApplication.setUserID(uid);
        unlockApplication.setReason(reason);
        unlockApplication.setApplicationDate(new Date());
        unlockApplication.setUsed(false);
        return unlockApplication;
    }

    public static AdminApplication createAdminApplication(String uid) {
        AdminApplication adminApplication = new AdminApplication();
        adminApplication.setUserID(uid);
        adminApplication.setApplicationDate(new Date());
        return adminApplication;
    }
}
